﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.ReworkManagement;
using Digitalmes.Model.ProductManagement;
using Digitalmes.Model.FactoryManagement;

namespace Digitalmes.Model.ReworkManagement
{
    /// <summary>
    /// 返工数据
    /// </summary>
	[Table("ReworkData")]

    [Display(Name = "_Model.ReworkData")]
    public class ReworkData : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ReworkData._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ReworkData._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }

        public Product Product { get; set; }    

        [Display(Name = "_Model._ReworkData._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._ReworkData._ReType")]
        [Comment("返工类型")]
        public ReworkType ReType { get; set; }
        [Display(Name = "_Model._ReworkData._ReType")]
        [Comment("返工类型")]
        public long? ReTypeId { get; set; }
        [Display(Name = "_Model._ReworkData._ReTypeDesc")]
        [Comment("返工描述")]
        public string ReTypeDesc { get; set; }
        [Display(Name = "_Model._ReworkData._ReasonName")]
        [Comment("原因名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ReasonName { get; set; }
        [Display(Name = "_Model._ReworkData._ReasonCode")]
        [Comment("原因编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ReasonCode { get; set; }
        [Display(Name = "_Model._ReworkData._Remark")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._ReworkData._WoId")]
        [Comment("工单号")]
        public long? WoId { get; set; }


        public ProductionLine Wo { get; set; }  

        [Display(Name = "_Model._ReworkData._WoCode")]
        [Comment("工单编码")]
        public string WoCode { get; set; }
        [Display(Name = "_Model._ReworkData._Sn")]
        [Comment("追溯码")]
        public string Sn { get; set; }
        [Display(Name = "_Model._ReworkData._Operation")]
        [Comment("操作员")]
        public string Operation { get; set; }
        [Display(Name = "_Model._ReworkData._Data")]
        [Comment("返工数据")]
        public string Data { get; set; }
        [Display(Name = "_Model._ReworkData._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
